package org.jackysoft.interceptor;

import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;

import org.jackysoft.annotations.ActionRequestMethod;
import org.jackysoft.annotations.MethodInceptor;
import org.jackysoft.entity.base.RootEntity;
import org.springframework.web.servlet.ModelAndView;

@MethodInceptor(method = ActionRequestMethod.upload)
public class UploadInterceptor extends AbstractInterceptor {

	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {

		Object part = modelAndView.getModelMap().get("part");

		Method service_m_gets = service.getClass().getMethod("create",
				Part.class, RootEntity.class);
		// 保存对象
		service_m_gets.invoke(service, part, bean);

	}

}
